<template>
  <div>
    <data-table
      ref="pagingTable"
      :options="options"
      :list-query="listQuery"
      @multi-actions="handleMultiAction"
    >
      <template slot="filter-content">
        <el-input
          v-model="listQuery.params.lessonName"
          style="width: 200px"
          placeholder="搜索课程名"
          class="filter-item"
        />

        <!-- <el-input
          v-model="listQuery.params.teacherName"
          style="width: 200px"
          placeholder="搜索老师名"
          class="filter-item"
        /> -->
      </template>

      <template slot="data-columns">
        <el-table-column
          type="selection"
          width="40"
        />
        <!-- <el-table-column align="center" label="课程名" prop="lessonId_dictText" /> -->

        <el-table-column align="center" label="学生" prop="studentName" />
        <el-table-column align="center" label="学号" prop="studentNum" />
        <el-table-column align="center" label="班级" prop="studentDept" />
        <el-table-column align="center" label="授课老师" prop="teacherId_dictText" />

        <!-- <el-table-column v-if="isTeacher" align="center" label="操作项" width="280">
          <template slot-scope="scope">
            <el-button
              id="btnEdit"
              size="mini"
              type="warning"
              icon="el-icon-share"
              @click="lessonDetail(scope.row)"
            >考试详情
            </el-button>
          </template>
        </el-table-column> -->
      </template>
    </data-table>

  </div>
</template>

<script>
import DataTable from '@/components/DataTable'

export default {
  name: 'StudentList',
  components: { DataTable },

  data() {
    return {

      listQuery: {
        current: 1,
        size: 20,
        params: {}
      },

      options: {
        // 可批量操作
        multi: false,
        // 列表请求URL
        listUrl: '/exam/api/sys/userLesson/paging',
        deleteUrl: '/exam/api/sys/userLesson/delete',
        // 批量操作列表
        multiActions: [
          {
            value: 'delete',
            label: '删除'
          }
        ]
      }

    }
  },

  created() {
    const lesson = this.$route.params.lesson
    if (typeof lesson !== 'undefined') {
      this.listQuery.params.lessonId = lesson.lessonId
      this.listQuery.params.teacherId = lesson.teacherId
      this.listQuery.params.lessonName = lesson.lessonName
      this.listQuery.params.teacherName = lesson.teacherName
    }
  },

  methods: {
    // lessonDetail(row) {
    //   this.lesson.lessonId = row.lessonId
    //   this.lesson.lessonName = row.lessonName
    //   this.lesson.teacherId = row.teacherId
    //   this.$router.push({ name: 'LessonExam', params: { lesson: this.lesson }})
    // }
  }
}
</script>
